import json
from jsonDealer.dataCombineAndClean import remove_invisible_characters
# 读取第一个 TXT 文件
with open('补充数据.txt', 'r',encoding='utf-8') as file1:
    data1 = file1.readlines()

# 读取第二个 JSON 文件
with open('concatenated.json', 'r',encoding='utf-8') as file2:
    data2 = json.load(file2)

# 合并两个 JSON 数据
idx = int(data2[-1]['id'])+1
for text in data1:
    # 修改data1的区域
    obj={}
    obj['id']=idx
    obj['content']=remove_invisible_characters(text)
    # 合并
    data2.append(obj)
    idx+=1
# 将合并后的数据写入新文件
print(len(data2))
print(data2[3982:3990])
exit()
with open('concatenated.json', 'w',encoding='utf-8') as merged_file:
    json.dump(data2, merged_file, indent=4,ensure_ascii=False)
